<?php

namespace App\Http\Controllers\Admin;

use App\Model\Entity\User;
use App\Model\Facades\AdminMenus;
use App\Model\Facades\AdminRoles;
use App\Model\Facades\Users;
use Illuminate\Http\Request;
use App\Http\Controllers\Controller;

class UserCtrl extends CommonCtrl
{
    //

    public function index()
    {
        $data['userList'] = User::all();
        return $this->responseView('index', $data);
    }

    public function roles()
    {
        $data['roles'] = AdminRoles::create()->index();
        $data['muen'] = AdminMenus::create()->getToTreeHtml();
        return $this->responseView('roles', $data);
    }

    public function setroles($id)
    {
        $query = Users::create()->rolesMenu($id);
        $query ? $this->success('操作成功') : $this->error('操作失败');
    }

    public function edit($id)
    {
        dd($id);
    }
}
